<?php
		session_start();
		require("inc/functions.php");
		require("inc/models/customer_model.php");
		if(isset($_POST['register'])){
			if(NewCustomer($_POST)){
				$_SESSION['first_name'] = $_POST['first_name'];
				$_SESSION['last_name'] = $_POST['last_name'];
				$_SESSION['is_logged_in'] = 1;
				$_SESSION['Keyword_id'] = 1;
				header("Location: index.php");
			}
		}
	 	require_once('inc/facebook.php');
	 	$facebook = new Facebook(array(
	 	'appId' => '266106703516634',
	 	'secret' => '57f64882d938b38d36f88185fc2fd78d'
		));
		
		$fbUser = $facebook->getUser();
		
		if(isset($_POST['login']))
			LoginUser($_POST);
		
	include("inc/views/header_view.php");
	include("inc/views/navbar_view.php");
?>

    <div class="container">
	<? if($fbUser): ?>
		<img src="http://graph.facebook.com/<?=$fbUser?>/picture" />
	 	<a href="<?=$facebook->getLogoutUrl()?>">Log Out</a>
	 	<? else: ?>
	 	<a href="<?=$facebook->getLoginUrl(array('scope' => 'read_stream, friends_likes'))?>">
	 	Log in with Facebook
		</a>
	<? endif; ?>
      <div class="row">
       	<div class="span5">
        	<form class="well" method="post" action="#">
            	<label for="first_name">First Name:</label>
            	<input type="text" name="first_name" id="first_name" placeholder="First Name" />
                <label for="last_name">Last Name:</label>
            	<input type="text" name="last_name" id="last_name" placeholder="Last Name"/>
                <input type="submit" name="register" value="Sign Up" class="btn btn-success" />
            </form>
        </div>
      </div>
<?php
	include("inc/views/footer_view.php");
?>